1. Field of the Invention
The invention relates generally to the field of playback/decoding of encoded digital video pixels and more specifically to an efficient software-based method for converting Yuv pixel data to RGB pixel data for displaying video data on computer video terminals.
2. Description of the Prior Art
Both in conventional analog video and digital computer video there is a strong need to minimize the amount of data that must be transferred in the video signal. The first compression mechanism used in encoding all current video technologies is to transform the camera color signals, RGB, into another color space, Yuv, which allows subsampling of the data stream across its u and v, chroma only, dimensions without substantial image degradation to human observers. This is possible because human vision encodes color perceptions into neural signals which transform Red, Green, and Blue signals into a Luminance component (i.e., Black and White style image signal) and two Chroma (color only) components. Another aspect of this neural encoding is that the density of chroma receptors is much less in the retina than the density of luminance receptors. Thus human color vision has much lower spatial sensitivity to chroma variations than to luminance variations. This allows data compression in the chroma subspace of video by subsampling the spatial variations of the chroma signals. The relationship between the Yuv and RGB color spaces is defined in the following equation sets 1 and 2.
Y=0.257R+0.504G+0.098B+16
U=xe2x88x920.148Rxe2x88x920.291G+0.439B+128
V=0.439Rxe2x88x920.368Gxe2x88x920.071 B+128xe2x80x83xe2x80x83(EQ 1)
xe2x80x83R=1.164(Y-16)xe2x88x920.002(U-128)+1.596(V-128)
G=1.164(Y-16)xe2x88x920.391 (U-128)xe2x88x920.813(V-128)
B=1.164(Y-16)+2.018(U-128)xe2x88x920.001(V-128)xe2x80x83xe2x80x83(EQ 2)
When reconstructing the video images from encoded video data for display on a computer video screen, this color space data compression method presents two computational problems for a software-based decoder in a computer system. The first problem is to reconstruct a fully sampled digital signal of each pixel""s color in the transformed color space, i.e., to undo the subsampling operation with as little loss as possible. The second problem is to efficiently convert the color space pixels from Yuv back to RGB so that they can be displayed on the computer video screen.
One example of how the first problem of undoing the subsampling operation is solved in a computer system is performing linear interpolation on 422 encoded Yuv pixel data. 422 encoded Yuv pixel data has the following sequence of color values:
Y0u0Y1v0Y2u2Y3v2 xc2x7 xc2x7 xc2x7.
This subsampled Yuv data stream is reconstructed by a computer system using a linear interpolation algorithm to approximate the odd numbered u and v components as:
Y0u0v0
Y1, u1=(u0+u2)/2, v1=(v0+v2)/2
Y2u2v2
Y3, u3=(u2+u4)/2, v3=(v2+v4)/2, etc.
The reconstructed Yuv data stream is referred to as supersampled Yuv pixel data.
After reconstructing each pixel of Yuv data from the subsampled Yuv data stream, the second problem of converting the supersampled Yuv pixel data to RGB pixel data for display on the computer screen is encountered. Some prior art methods used in computer systems for converting Yuv pixel data to RGB pixel data are using special hardware converters to solve the EQ 2 set of equations, solving the EQ 2 set of equations using a software algorithm, and using well-known Color LookUp Table (CLUT) decoding. Each of these Yuv to RGB pixel conversion methods has drawbacks that limit their usefulness in computer video systems. Hardware converters are an effective but expensive method for converting video pixel data. Today""s computers do not have the processing power to display quality motion video images by directly solving the EQ 2 set of equations using a software algorithm. And CLUT video decoding suffers from the drawbacks of color flashing, need to update the CLUT for scene changes, and color posterization in smooth gradient areas as will be further explained.
CLUT video decoding combines supersampled Yuv pixel bit values to compute an index into a Color Index LookUp Table (Cl LUT) typically having 32,768 (32K) entries, extracts from the Cl LUT an 8-bit Color LookUp Table Color Index (CLUT Cl) value which is stored in the framebuffer. This value in the framebuffer is then used to select one of 256 RGB pixel data entries in the CLUT. The selected RGB pixel data entry is then sent to three Digital-to-Analog Converters (DACs) which convert separately on the R, G, and B components of the RGB pixel data to drive the display on the computer video screen.
CLUT video decoding presents a number of problems for a computer software-based video pixel decoding system. During encoding, the video authoring program must derive a CLUT that best represents each video frame""s colors. This calculation is quite expensive to perform since a three dimensional space of colored points (pixels) must be mapped into no more than 256 colors by the use of histogramming techniques. For example, when flesh tones are important (i.e., have more pixels in the scene) there might be hundreds of CLUT entries that only vary by a small amount in the flesh tone color regions, whereas blue sky, green grass color values might be compressed to less than 10 color table values. Using a generic system color palette (CLUT) gives unacceptable, cartoonish color effects. Since many frames can use the same palette the authoring program only includes the video CLUT in the encoded video data stream when there has been a scene change. When the authoring program outputs a new CLUT it must also output the Color Index LUT since calculating the Cl LUT is much too expensive for the software decoder to do in real time. In a computer software-based video pixel decoding system, updating the CLUT and Cl LUT for each scene change causes color flashing on the screen. Very bad scene colors result if the CLUT is not updated for each scene change.
The limited number of CLUT colors, typically 256, available for a given frame causes additional problems of posterization of smooth gradient areas, especially in a multiple window computer environment. Posterization is a contour line type representation of a smooth color gradient area. The problem of color posterization occurs when gradually changing colors are approximated by a smaller range of colors in the CLUT. In this case, one part of the gradually changing colors will all be approximated by a single color from the CLUT and the next part of the gradually changing colors will abruptly be approximated by another color from the CLUT. This results in a sharp change in color that poorly approximates the original gradual color change and creates a contour line appearance. In a multiple window computer environment, only one CLUT is available for all of the windows displayed on the computer screen. Since the colors needed from window to window may vary drastically, the limited number of colors available in the CLUT can cause serious color degradation.
Due to its limitations, CLUT video decoding is not optimal for video decoding in a computer system. Neither does solving equation set 2 using a software algorithm result in quality motion video for todays computer systems. And specialized hardware decoding systems are expensive, putting them out of the economic reach of many computer users. As a result of these factors there is a need for an efficient software-based method for converting Yuv pixel data to RGB pixel data such that quality motion video can be displayed on todays computer systems.
Accordingly, it is an object of the present invention to provide a software-based method for converting pixel data of a first format to pixel data of a second format such that quality motion video can be displayed on todays computer systems.
Another object of the present invention to provide a software-based method for converting pixel data of a first format to pixel data of a second format without the color flashing or posterization of smooth gradient areas exhibited by the CLUT conversion method.
The present invention provides a software-based computer method for converting pixel data of a first format to pixel data of a second format for display on a computer video screen compatible with the second format. Pixel data of the first format is used to create an index value which indexes a lookup table to find corresponding pixel data of the second format. The corresponding pixel data of the second format is then displayed on the computer video screen which is compatible with the second format.
The preferred embodiment of the present invention provides a software-based computer method for converting 24-bit Yuv pixel data (8-bits Y, 8-bits u, and 8-bits v) to 24-bit RGB pixel data (8-bits R, 8-bits G, and 8-bits B). The 8-bits of R, G, and B pixel data are then converted to three analog signals by three digital-to-analog converters (DACs). The three analog signals are used to drive the computer video screen for displaying the pixel data.
In another embodiment, the present invention provides a software-based computer method for converting 24-bit Yuv pixel data (8-bits Y, 8-bits u, and 8-bits v) to 16-bit 565RGB pixel data (5-bits R, 6-bits G, and 5-bits B). 565RGB has the advantage that it requires a smaller framebuffer and provides quality color conversion if the RGB conversion values are chosen such that the luminance error is minimized. The R, G, and B pixel data values are then converted to three analog signals by three digital-to-analog converters (DACs). The three analog signals are used to drive the computer video screen for displaying the pixel data.
Performance estimates of the software-based method of the present invention running on state-of-the-art microprocessors such as Intel 386(trademark), 486(trademark), or 586(trademark) brand microprocessors show that the method of the present invention requires about the same processing power as the CLUT method. But the method of the present invention solves the CLUT problems of color flashing and posterization of smooth gradient areas.
Other objects, features, and advantages of the present invention will be apparent from the accompanying drawings and the detailed description that follows.